<template>
    <views class="indexs">
        <div class="upper_section flex flexC flexJ">
            <div class="head flex flexR flexJ center">
                <viewTitle title="服务商管理" :border="true"> </viewTitle>
                <el-button type="primary" @click="add_facilitator">新增服务商</el-button>
            </div>
            <div class="lower_section flex flexR flexJ">
                <div class="record flex flexC flexJp enterprise">
                    <div class="record_head flex flexR flexJ center">
                        <div class="backimg flex center">
                            <i class="el-icon-user"></i>
                            签约企业
                        </div>
                        <div class="number">{{enterprise_count}}</div>
                    </div>
                    <div class="record_down flex">
                        <el-button @click="look_enterprises">查看详情</el-button>
                    </div>
                </div>

                <div class="record flex flexC flexJp facilitator">
                    <div class="record_head flex flexR flexJ center">
                        <div class="backimg flex center">
                            <i class="el-icon-school"></i>
                            签约服务商
                        </div>
                        <div class="number">{{facilitator_count}}</div>
                    </div>
                    <div class="record_down flex">
                        <el-button @click="look_facilitator">查看详情</el-button>
                    </div>
                </div>
            </div>


        </div>
       
        <!-- 图表 -->
        <div  class="erchats" v-if="day.length > 0">
            <zx-echart :title="title" :day="day" :charge_money="charge_money" :dispatch_money="dispatch_money"></zx-echart>
        </div>

    </views>
</template>




<script>
export default {
       name:"indexs",
       data(){
           return {
               title:'平台交易',
               enterprise_count: 0,
               facilitator_count: 0,
               day:[],      //平台交易横坐标数组
               charge_money:[],      //平台交易 充值金额线条
               dispatch_money:[],      //平台交易 代发金额线条


           }
        },
        mounted(){
            this.getIndex();
        },
        methods:{
            getIndex(){         //获取首页数据
                this.$raxios.post(this.$mapapi.index, {}).then(res => {
                    if(res.code != 200&&res.code!=501)    return  Promise.reject(res.msg);
                    this.enterprise_count = res.data.enterprise_count;
                    this.facilitator_count = res.data.facilitator_count;
                    this.day = res.data.day;
                    this.charge_money = res.data.charge_money;
                    this.dispatch_money = res.data.dispatch_money;
                }).catch(res => {
                    this.$message.error(res);
                });
            },
            add_facilitator(){      //新增供应商
                this.$router.push({path: '/facilitator_list/facilitator_list_add'});
            },
            look_enterprises(){     //查看企业列表
                this.$router.push({path: '/enterprise_list'});
            },
            look_facilitator(){     //查看服务商列表
                this.$router.push({path: '/facilitator_list'});
            }

        }
}
</script>








<style lang="less"  :scope="true" src="@/style/home/index.less" >
    
</style>